package com.wk1un2.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wk1un2.entity.Switch;
import com.wk1un2.service.SwitchService;
import com.wk1un2.util.Result;

@RequestMapping("/switch")
@RestController
public class SwitchController {
	@Autowired
	SwitchService switchService;

	@RequestMapping("getState")
	public Object getState() {
		Result res = new Result(200, "success", 1, switchService.getState());
		return res;
	}

	@RequestMapping("updateState")
	public Object updateState(Switch s) {
		Result res = new Result(200, "success", switchService.updateState(s), s);
		return res;
	}
}
